var arr = [1, 2, 3, 4, 5, 6, 7]
// var a = arr.splice(1, 2, 8, 9)
// console.log(arr,a)
function arraySplice(arr, start, deleteCount) {
    if (!arr || arr.constructor !== Array) throw new Error(arr + "not is Array");
    if (start === undefined) return []
    start = ~~start;
    if (start < 0) start = (start + arr.length) < 0 ? 0 : start + arr.length
    if(deleteCount===undefined) deleteCount = arr.length - start;
    deleteCount = ~~deleteCount;
    if(deleteCount<0) deleteCount = 0
    if(deleteCount + start> arr.length) deleteCount = arr.length - start
    var arr1 =  []
    for(let i = start;i<arr.length;i++){
        if(i<start+deleteCount) arr1[arr1.length] = arr[i]
        arr[i] = arr[i+deleteCount]
    }
    arr.length -= deleteCount
    let len = arguments.length-3
    if(len<=0) return arr1
    for (var j = arr.length - 1 + len; j >= start; j--) {
        if (j >= start + len) arr[j] = arr[j - len];
        else arr[j] = arguments[3 + j - start];
    }
    return arr1;
}
console.log(arraySplice(arr,2,8,9))
// console.log(arr1)